package com.stp.config.controller;

import cn.hutool.core.lang.UUID;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.TimeUnit;

/**
 * https://blog.csdn.net/u011974797/article/details/138123261
 */
@Slf4j
@RequestMapping("/http")
@RestController
public class HttpController {

    @Resource
    private RedisTemplate<String,String> redisTemplate;

    @Value("${app-id}")
    private String appId;

    @Value("${secret-key}")
    private String appSecret;

    /**
     * 生成应用id和密钥
     */
    @RequestMapping(value = "/getSecret", method = RequestMethod.GET)
    public Map<String, String> getSecret() {
        Map<String, String> map = new HashMap<>();
        map.put("appId", appId);
        map.put("appSecret", appSecret);
        return map;
    }

    /**
     * 测试签名
     */
    @RequestMapping(value = "/sign", method = RequestMethod.GET)
    public String sign() {
        return "success";
    }
}
